<?php

namespace app\api\controller;

use app\services\ConfigService;
use app\services\EmailService;
use app\services\GoodsService;
use app\services\MusicService;
use app\services\NameCardService;
use app\services\OrderService;
use app\services\PropertyService;
use app\services\StockService;
use app\services\TeamReleaseLogService;
use app\services\UpLineService;
use app\services\UserCouponService;
use app\services\UserLevelService;
use app\services\UserPropertyService;
use app\services\UserService;
use app\services\UserTeamService;
use Overtrue\Pinyin\MemoryFileDictLoader;
use Overtrue\Pinyin\Pinyin;
use plugin\admin\app\model\Area;
use plugin\admin\app\model\Music;
use plugin\admin\app\model\Order;
use plugin\admin\app\model\Rule;
use plugin\admin\app\model\TeamSpeedUpConfig;
use plugin\admin\app\model\TeamSpeedUpLog;
use support\Cache;
use support\Db;
use support\KuaidiBird;
use support\Request;

class TestController
{
    public function test(Request $request)
    {
        $type = $request->get('type');
        Db::beginTransaction();
        try {
            if (is_null($type)) {
                PropertyService::releaseUserFreezeIntegral('share', false);
                PropertyService::releaseUserFreezeIntegral('team', false);
            } else {
                PropertyService::releaseUserFreezeIntegral($type, false);

            }

            Db::commit();

            return '执行成功';
        } catch (\Exception $e) {
            Db::rollBack();
            echo $e->getMessage() . $e->getTraceAsString();
        }


//        UserPropertyService::extraRebate();
    }

    public function test2(Request $request)
    {
        try {
            OrderService::rebate(Order::where('order_no', $request->get('order_no'))->first());

        } catch (\Exception $e) {
            echo $e->getMessage() . $e->getTraceAsString();
        }
    }
}